#ifndef CLIENT_SURFACE_H
#define CLIENT_SURFACE_H
//******************************************************************************
//*this code is protected by the GNU affero GPLv3
//*author:Sylvain BERTRAND <sylvain.bertrand AT gmail dot com>
//*                        <digital.ragnarok AT gmail dot com>
//******************************************************************************
#define PENDING_DAMAGES_N_MAX 8
struct damage{
  s32 x;
  s32 y;
  s32 w;
  s32 h;
};

struct surface{
  s32 pending_buffer_slot;
  //location of the surface *in* the buffer
  s32 pending_buffer_x;
  s32 pending_buffer_y;

  s32 pending_damages_n;
  struct damage pending_damages[PENDING_DAMAGES_N_MAX];

  u8 frame_callback_valid;
  u32 frame_callback_id;

  s32 pending_opaque_region_slot;
  s32 pending_input_region_slot;
};
s8 surface_destroy(struct client *c,s32 surface_slot);
s8 surface_new_visible(struct client *c,u32 surface_id);
s8 surface_attach(struct client *c,s32 surface_slot,u32 buffer_id,s32 x,s32 y);
s8 surface_damage(struct client *c,s32 surface_slot,s32 x,s32 y,s32 w,s32 h);
s8 surface_frame(struct client *c,s32 surface_slot,u32 callback_id);
s8 surface_set_opaque_region(struct client *c,s32 surface_slot,u32 region_id);
s8 surface_set_input_region(struct client *c,s32 surface_slot,u32 region_id);
s8 surface_commit(struct client *c,s32 surface_slot);
#endif
